<?php
/*
 * 日志配置
 */
return [
    'traceLevel' => YII_DEBUG ? 3 : 0,
    'targets'    => [
        /* 全部[操作]日志级别存储 */
        [
            'class'   => 'yii\log\FileTarget',
            'levels'  => ['info', 'trace', 'profile'],
            'logFile' => '@runtime/logs/default/info/log_' .
                date('Y-m-d', time()) . '.log',
            'except'  => [
                'yii\web\UrlManager::*',
            ],
        ],
        /* 全部[错误]日志级别存储 */
        [
            'class'   => 'yii\log\FileTarget',
            'levels'  => ['error', 'warning'],
            'logFile' => '@runtime/logs/default/error/log_' .
                date('Y-m-d', time()) . '.log'
        ],
        /* 全部[数据库][错误]、[警告]日志级别存储 */
        [
            'class'   => 'yii\log\FileTarget',
            'levels'  => ['error', 'warning'],
            'categories' => ['db', 'yii\db\Command::query'],
            'logFile' => '@runtime/logs/db/error/log_' .
                date('Y-m-d', time()) . '.log'
        ],
        /* 全部[数据库][正常]日志级别存储 */
        [
            'class'   => 'yii\log\FileTarget',
            'levels'  => ['info', 'trace', 'profile'],
            'categories' => ['db', 'yii\db\Command::query'],
            'logFile' => '@runtime/logs/db/info/log_' .
                date('Y-m-d', time()) . '.log'
        ],
        /* 全部[缓存][错误]、[警告]日志级别存储 */
        [
            'class'   => 'yii\log\FileTarget',
            'levels'  => ['error', 'warning'],
            'categories' => ['cache'],
            'logFile' => '@runtime/logs/cache/error/log_' .
                date('Y-m-d', time()) . '.log'
        ],
    ]
];
